home *** CD-ROM | disk | FTP | other *** search
- // Stero Positioning - Version 1.0
-
- // This Program Sets the audio levels of the first set of popups
- // to the x position of the layer in popup 2, scaled to lie within the range [min_DB, max_DB].
- // It only applies keyframes during the duration of the audio layer.
- // LAYER PROPERTY CHANNEL
- // ------ ---------- --------
- // 1: Layer with audio Audio Levels doesn't matter
- // 2: Layer with position data doesn't matter doesn't matter
-
- min_DB = -18;
- max_DB = 3;
-
- if (time() == start_time) { //initialization
- audio_in = layer_time_bounds(pop_layer(2))[0] ;
- audio_out = layer_time_bounds(pop_layer(2))[1] ;
- }
-
- if ( (time() >= audio_in) && (time() <= audio_out) ) {
-
- pos = value(pop_layer(2), position);
-
- if (pos[X] > comp_size) {
- pos[X] = comp_size[0];
- }
-
- if (pos[X] < 0) {
- pos[X] = 0;
- }
-
- left_interp = pos[X] / comp_size[0];
- right_interp = 1.0 - left_interp;
-
- //Left Channel
- value(pop_layer(1), pop_property(1)) [0] = left_interp * (max_DB - min_DB) + min_DB;
-
- //Right Channel
- value(pop_layer(1),pop_property(1)) [1] = right_interp * (max_DB - min_DB) + min_DB;
- }